package com.buaa.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * Created by DELL on 2018/4/14.
 */
public class MathUtil {

    public static List<Double> normalize(List<Double> datalist){
        double maxvalue = Collections.max(datalist);
        double minvalue = Collections.min(datalist);

        double distance = maxvalue - minvalue;

        List<Double> newList = new ArrayList<>();
        for(double each:datalist){
            double newEach = (each-minvalue)/distance;
            newList.add(newEach);
        }
        return newList;
    }

    public static List<Double> soft(List<Double> datalist){
        //Collections.sort(datalist);

        for(int i=0;i<datalist.size();i++){
            datalist.set(i,Math.max(25 - 0.5 * i,10));
        }
        return datalist;
    }
}
